package com.example.blog.utils;

import java.util.Random;

/**
 * name: 东北宋小宝
 * date: 2020/8/14
 */
public class SaltUtils {
    /***
     * 生产salt方法
     */
    public static String getSalt(int num){
        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0 ; i<num ; i++ ){
            char aChar = chars[new Random().nextInt(chars.length)];
            stringBuilder.append(aChar);
        }
        return stringBuilder.toString();
    }
}
